import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios';

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    data:[]
  },
  getters: {
  },
  mutations: {
    setlist(state,data){
      state.data=data
    }
  },
  actions: {
    getlist({commit}){
      return new Promise((resolve, reject) => {
        axios.get("/api/list").then((res)=>{
         commit("setlist",res.data)
         console.log(res.data);
         resolve()
        })
      })
     
    }
  },
  modules: {
  }
})
